import Taro, {Component} from '@tarojs/taro'
import {AtList, AtListItem} from "taro-ui";
import {View} from "@tarojs/components"
import MyFabBtn from "../../../components/MyFabBtn/index";
import {navigateWithAuth} from "../../../utils";
import './index.scss'


import {getGlobalData} from "../../../global.d";
export default class Index extends Component {
  config = {
    navigationBarTitleText: '个人信息'
  };

  constructor(props) {
        super(props);
        this.state = {
          userDetail:{
            school:'',
            college: '',
            major: '',
            grade: '',
            userRealName:'',
            phone:'',
            weChat: '',
            qq: '',
            email: ''
          }
        }
    }
  componentDidMount() {
    const user = getGlobalData('user');
    this.setState({
      userDetail: user.userDetail || {}
    })
  }


  render() {
    const {userDetail} = this.state;
         return (
           <View className='my-info'>
             <AtList>
               <AtListItem title='学校' extraText={userDetail.school || '未填写'} onClick={() => navigateWithAuth(`/pages/my/personInfo/edit/index`)} />
               <AtListItem title='学院' extraText={userDetail.college || '未填写'} onClick={() => navigateWithAuth(`/pages/my/personInfo/edit/index`)} />
               <AtListItem title='专业' extraText={userDetail.major || '未填写'} onClick={() => navigateWithAuth(`/pages/my/personInfo/edit/index`)} />
               <AtListItem title='年级' extraText={userDetail.grade || '未填写'} onClick={() => navigateWithAuth(`/pages/my/personInfo/edit/index`)} />
               <AtListItem title='姓名' extraText={userDetail.userRealName || '未填写'} onClick={() => navigateWithAuth(`/pages/my/personInfo/edit/index`)} />
               <AtListItem title='手机号' extraText={userDetail.phone || '未填写'} onClick={() => navigateWithAuth(`/pages/my/personInfo/edit/index`)} />
               <AtListItem title='微信' extraText={userDetail.weChat || '未填写'} onClick={() => navigateWithAuth(`/pages/my/personInfo/edit/index`)} />
               <AtListItem title='QQ号' extraText={userDetail.qq || '未填写'} onClick={() => navigateWithAuth(`/pages/my/personInfo/edit/index`)} />
               <AtListItem title='邮箱' extraText={userDetail.email || '未填写'} onClick={() => navigateWithAuth(`/pages/my/personInfo/edit/index`)} />
             </AtList>
             <MyFabBtn onClick={() => navigateWithAuth(`/pages/my/personInfo/edit/index`)} />
           </View>
        )
    }

}
